const Sound = require('react-native-sound');
audioHelper: Sound;

constructor(){
  super();
  Sound.setCategory('Playback');

 this.audioHelper = new Sound('new_order.mp3', Sound.MAIN_BUNDLE, (error) => {
    if (error) {
      console.log('failed to load the sound', error);
      return;
    }
    // loaded successfully
    console.log('duration in seconds: ' + this.audioHelper.getDuration() + 'number of channels: ' + this.audioHelper.getNumberOfChannels());
   // Reduce the volume by half
   this.audioHelper.setVolume(1);

  });


}
playAudio = () => {
  if(this.audioHelper.isPlaying()){
    this.audioHelper.stop();
  }
  this.audioHelper.play((success) => {
    if (success) {
      console.log('successfully finished playing');
    } else {
      console.log('playback failed due to audio decoding errors');
    }
  });

}
